/**
 * @author zhangdi
 * @version 1.0
 * @date 2022.4.19 8:50
 */
public class app1 {
    private Long StringToInt(String ipStr) {
        Long ip = 0L;

        if (ipStr != null) {
            String[] ipItem = ipStr.split("\\.");
            for (String s : ipItem) {
                ip = ip << 8;
                System.out.println(ip);
                ip += Integer.parseInt(s);
                System.out.println(ip);
            }
        }

        return ip;
    }

    public String getIPString(final Long IPNum) {
        final Long andNumbers[] = {0xff000000L, 0x00ff0000L, 0x0000ff00L, 0x000000ffL};
        final StringBuilder IPStrSb = new StringBuilder();
        for (int i = 0; i < 4; i++) {
            IPStrSb.append(String.valueOf((IPNum & andNumbers[i]) >>> 8 * (3 - i)));
            if (i != 3) {
                IPStrSb.append(".");
            }
        }
        return IPStrSb.toString();
    }

    public static void main(String[] args) {
//        app1 app1 = new app1();
//        Long ipNum = app1.StringToInt("192.168.2.33");
//        String ipStr = app1.getIPString(ipNum);
//        System.out.println(ipStr);

        int a = 192, b = 168, c = 10, d = 5;
        long a1 = a << 24, b1 = b << 16, c1 = c << 8, d1 = d<<0;
        System.out.println(a1 + "   " + b1 + "   " + c1 + "   " + d1);
        long r1 = a1+b1+c1+d1;
        System.out.println((r1>>>24)&255);
        System.out.println((r1>>>16)&255);
        System.out.println((r1>>>8)&255);
        System.out.println((r1)&255);
    }
}
